home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
051-075
/
disk_061
/
filldisk
/
filldisk.c
< prev
Wrap
C/C++ Source or Header
|
1992-05-06
|
1KB
|
52 lines
/*
* A simple minded, 5 minute, program to trash all free blocks on a
* disk by just writing a file full of garbage until the disk is full.
*
* This insures that any proprietary data left on the disk after
* deleting files is clobbered. Otherwise, disksalv might find
* some interesting tidbits...
*
* To use, just run and wait for the requestor to come up when
* the disk is full. Cancel the requestor and the file "junkfile"
* will be left, and the disk will be full. Delete the file
* to free up the scribbled blocks.
*
*/
#include <stdio.h>
static char buf[512];
#define FILENAME "junkfile"
#define MSG "This block has been subjected to bit rot (better luck next time!)"
int main ()
{
register FILE *fp;
register int count = 0;
if ((fp = fopen (FILENAME, "r")) != NULL) {
(void) fprintf (stderr, "%s: file exists already!\n", FILENAME);
} else {
(void) fclose (fp);
if ((fp = fopen (FILENAME, "w")) == NULL) {
(void) fprintf (stderr, "%s: can't open for write!\n",
FILENAME);
} else {
(void) strcpy (buf, MSG);
while (fwrite (buf, sizeof (buf), 1, fp) == 1) {
count++;
if ((count % 100) == 0) {
(void) printf ("Reached block %d ...\r",
count);
(void) fflush (stdout);
}
}
(void) printf ("Total of %d blocks written\n", count);
(void) fflush (stdout);
(void) fclose (fp);
}
}
return (0);
}